<?php
namespace app\modules\v1\controllers;
use Yii;
use yii\rest\ActiveController;
use app\modules\v1\models\Log;
use yii\web\NotFoundHttpException;
use app\modules\v1\models\Lawyerdetail;
use app\modules\v1\models\Lawyerfile;

class LawyerRemixInfoAllController extends ActiveController{
    
    public $modelClass = '';
    
    public function actions() {
        $actions = parent::actions();
        unset($actions['index'], $actions['view'], $actions['create'], $actions['update'], $actions['delete']);
    }
    
    public function actionIndex(){
        $infoModel = new Lawyerdetail;
        $fileModel = new Lawyerfile;
        $info = $infoModel->find()->all();
        $file = $fileModel->find()->all();
        $count = count($info);
        for($i = 0; $i<$count; $i++){
            $all[$i] = [$info[$i], $file[$i]]; 
        }
        return $all;
    }
    
    protected function log($op,$data){
        
        $log = new Log();
        
        $log->attributes = ['operation' => $op,'class' => 'LawyerRemixAll','requestData' => $data,'dateTime' => date('Y-m-d H:i:s'),'ip' => Yii::$app->request->userIP];
        
        if(!$log->save()){
            return $log->getFirstError();
        }
        
    }
    
}